package com.example.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.UUID;

/**
 * @Description TODO
 * @Date 2024/6/2 20:16
 * @Created by houjunfeng
 */
@Repository
public class ResourceDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Transactional
    public void insertGoods(){

        String sql = "INSERT INTO `mybaties-plus`.`goods` (`name`, `price`, `version`) VALUES ( ?, ?, ?)";
        String name = UUID.randomUUID().toString().substring(0,5);
        jdbcTemplate.update(sql,name,3.54,0);
        int i=1/0;
    }
}
